Metadata
aliases: [Functional languages have no necessary execution order, functional languages have no necessary execution order, Execution order in functional programming languages]
shorthands: {}
created: 2022-07-12 14:52:34
modified: 2022-07-15 11:22:38
In functional languages, function calls cannot change the values associated with common names. Hence, the order in which nested function calls are carried out does not matter because function calls cannot interact with each other.
In functional languages, there is no necessary execution order.
Of course they have to be executed in an order, but this order does not affect the end result. This independence is one of the strengths of functional languages.
Let's define the following functions:
FUNCTION F(X,Y,Z:INTEGER):INTEGER ;
BEGIN ... END
FUNCTION A(P:INTEGER):INTEGER ;
BEGIN ... END
FUNCTION B(Q: INTEGER):INTEGER ;
BEGIN ... END
FUNCTION C(R: INTEGER):INTEGER ;
BEGIN ... END
Then, in a functional language, in the following function call:
F(A(D),B(D),C(D))
The order in which A(D), B(D) and C(D) are carried out does not matter because the functions A, B and C cannot change their common actual parameter D.